/*    */ package client.inventory;
/*    */ 
/*    */ import java.io.File;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import provider.MapleData;
/*    */ import provider.MapleDataProvider;
/*    */ import provider.MapleDataProviderFactory;
/*    */ import provider.MapleDataTool;
/*    */ import tools.Pair;
/*    */ 
/*    */ 
/*    */ public class PetDataFactory
/*    */ {
/* 15 */   private static final MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Item.wz"));
/* 16 */   private static final Map<Pair<Integer, Integer>, PetCommand> petCommands = new HashMap<>();
/* 17 */   private static final Map<Integer, Integer> petHunger = new HashMap<>();
/*    */   
/*    */   public static PetCommand getPetCommand(int petId, int command) {
/* 20 */     PetCommand ret = petCommands.get(new Pair(Integer.valueOf(petId), Integer.valueOf(command)));
/* 21 */     if (ret != null) {
/* 22 */       return ret;
/*    */     }
/* 24 */     MapleData petData = dataRoot.getData("Pet/" + petId + ".img");
/* 25 */     int prob = 0;
/* 26 */     int inc = 0;
/* 27 */     if (petData != null) {
/* 28 */       prob = MapleDataTool.getInt("interact/" + command + "/prob", petData, 0);
/* 29 */       inc = MapleDataTool.getInt("interact/" + command + "/inc", petData, 0);
/*    */     } 
/* 31 */     ret = new PetCommand(petId, command, prob, inc);
/* 32 */     petCommands.put(new Pair(Integer.valueOf(petId), Integer.valueOf(command)), ret);
/* 33 */     return ret;
/*    */   }
/*    */   
/*    */   public static int getHunger(int petId) {
/* 37 */     Integer ret = petHunger.get(Integer.valueOf(petId));
/* 38 */     if (ret != null) {
/* 39 */       return ret.intValue();
/*    */     }
/* 41 */     MapleData hungerData = dataRoot.getData("Pet/" + petId + ".img").getChildByPath("info/hungry");
/* 42 */     ret = Integer.valueOf(MapleDataTool.getInt(hungerData, 1));
/* 43 */     petHunger.put(Integer.valueOf(petId), ret);
/* 44 */     return ret.intValue();
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\client\inventory\PetDataFactory.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */